/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* IBust - IBus with Traditional interface
 * Copyright(c) 2013 Daniel Sun
 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
 * Copyright (C) 2008-2010 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#if !defined (__IBUST_H_INSIDE__) && !defined (IBUST_COMPILATION)
#error "Only <ibust.h> can be included directly"
#endif

/**
 * SECTION: ibustsimpleengine
 * @short_description: Input method engine supporting table-based input method
 * @title: IBustEngineSimple
 * @stability: Stable
 *
 * An IBustEngineSimple provides table-based input method logic.
 *
 * see_also: #IBustEngine
 */
#ifndef __IBUST_ENGINE_SIMPLE_H__
#define __IBUST_ENGINE_SIMPLE_H__

#include "ibustengine.h"

G_BEGIN_DECLS

#define IBUST_MAX_COMPOSE_LEN 7

/*
 * Type macros.
 */

/* define GOBJECT macros */
#define IBUST_TYPE_ENGINE_SIMPLE             \
    (ibust_engine_simple_get_type ())
#define IBUST_ENGINE_SIMPLE(obj)             \
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUST_TYPE_ENGINE_SIMPLE, IBustEngineSimple))
#define IBUST_ENGINE_SIMPLE_CLASS(klass)     \
    (G_TYPE_CHECK_CLASS_CAST ((klass), IBUST_TYPE_ENGINE_SIMPLE, IBustEngineSimpleClass))
#define IBUST_IS_ENGINE_SIMPLE(obj)          \
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUST_TYPE_ENGINE_SIMPLE))
#define IBUST_IS_ENGINE_SIMPLE_CLASS(klass)  \
    (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUST_TYPE_ENGINE_SIMPLE))
#define IBUST_ENGINE_SIMPLE_GET_CLASS(obj)   \
    (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUST_TYPE_ENGINE_SIMPLE, IBustEngineSimpleClass))

typedef struct _IBustEngineSimple IBustEngineSimple;
typedef struct _IBustEngineSimpleClass IBustEngineSimpleClass;
typedef struct _IBustEngineSimplePrivate IBustEngineSimplePrivate;

/**
 * IBustEngineSimple:
 *
 * IBustEngineSimple properties.
 */
struct _IBustEngineSimple {
    /*< private >*/
    IBustEngine parent;
    IBustEngineSimplePrivate *priv;

    /* instance members */
    /*< public >*/
};

struct _IBustEngineSimpleClass {
    /*< private >*/
    IBustEngineClass parent;

    /* class members */
    /*< public >*/
    /* signals */
    
    /*< private >*/
    /* padding */
    gpointer pdummy[8];
};

GType   ibust_engine_simple_get_type       (void);

/**
 * ibust_engine_simple_add_table:
 * @simple: An IBustEngineSimple.
 * @data: (element-type guint16) (array): The table which must be available
 *      during the whole life of the simple engine.
 * @max_seq_len: Maximum length of a swquence in the table (cannot be greater
 *      than %IBUST_MAX_COMPOSE_LEN)
 *
 * Adds an additional table to search to the engine. Each row of the table
 * consists of max_seq_len key symbols followed by two guint16 interpreted as
 * the high and low words of a gunicode value. Tables are searched starting from
 * the last added.
 *
 * The table must be sorted in dictionary order on the numeric value of the key
 * symbol fields. (Values beyond the length of the sequence should be zero.)
 */
void    ibust_engine_simple_add_table      (IBustEngineSimple     *simple,
                                           const guint16        *data,
                                           gint                  max_seq_len,
                                           gint                  n_seqs);

G_END_DECLS

#endif // __IBUST_ENGINE_SIMPLE_H__
